package com.wang.hashtest;

import java.util.HashMap;

/**
 * @Author: along
 * @Create: 2021/9/13
 * @Description:HashMap线程不安全问题
 */
public class HashMapTest8 {
    private static HashMap<Integer, String> map = new HashMap<Integer, String>(2, 0.75f);

    public static void main(String[] args) {
        map.put(5, "c");

        new Thread(() -> {
            map.put(7, "b");
            System.out.println(map);
        }, "Thread1").start();


        new Thread(() -> {
            map.put(3, "a");
            System.out.println(map);
            System.out.println(map.get(11));
        }, "Thread2").start();
    }
}
